#include<iostream>
using namespace std;

struct MyException : public exception{
    const char * what () const throw ()
    {
        return "C++ Exception";
    }
};

int main(){
    try
    {
        int a = 4;
        if(a < 3)
        {
            throw MyException();
        } 
        else if(a == 4)
        {
            throw exception();
        };
        return 0;
    }catch(MyException& e)
    {
        cout << "MyException caught" << endl;
        cout << e.what() << endl;
    }catch(exception& e)
    {
        cout << "exception caught" << endl;
    }
    
};